import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/home/index.vue'),
    meta: {
      isShow: true
    }
  },
  {
    path: '/map',
    name: 'map',
    component: () => import('../views/map/index.vue'),
    meta: {
      isShow: false
    }
  },
  {
    path: '/topic',
    name: 'topic',
    component: () => import( '../views/topic/index.vue'),
    meta: {
      isShow: true
    }
  },
  {
    path: '/category',
    name: 'category',
    component: () => import( '../views/category/index.vue'),
    meta: {
      isShow: true
    }
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import( '../views/cart/index.vue'),
    meta: {
      isShow: true
    }
  },
  {
    path: '/profile',
    name: 'profile',
    component: () => import( '../views/profile/index.vue'),
    meta: {
      isShow: true
    }
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import( '../views/detail/index.vue'),
    meta: {
      isShow: false
    }
  },
  {
    path: '/project',
    name: 'project',
    component: () => import( '../views/project/index.vue'),
    meta: {
      isShow: false
    }
  },
  {
    path: '/categorylist',
    name: 'categorylist',
    component: () => import( '../views/categorylist/index.vue'),
    meta: {
      isShow: false
    }
  },
  {
    path: '/search',
    name: 'search',
    component: () => import( '../views/search/index.vue'),
    meta: {
      isShow: false
    }
  },
  // params 传值 
  {
    path: '/topdetail/:id',
    name: 'topdetail',
    component: () => import( '../views/topdetail/index.vue'),
    meta: {
      isShow: false
    }
  },
  {
    path: '/brandlist',
    name: 'brandlist',
    component: () => import( '../views/brand/index.vue'),
    meta: {
      isShow: false
    }
  },
  {
    path: '/feedback',
    name: 'feedback',
    component: () => import( '../views/feedback/index.vue'),
    meta: {
      isShow: false
    }
  },
  // 订单
  {
    path: '/payload',
    name: 'payload',
    component: () => import( '../views/payload/index.vue'),
    meta: {
      isShow: false
    }
  },
  // 收藏
  {
    path: '/collect',
    name: 'collect',
    component: () => import( '../views/collect/index.vue'),
    meta: {
      isShow: false
    }
  },
  // 新建地址 第一级
  {
    path: '/address',
    name: 'address',
    component: () => import( '../views/address/index.vue'),
    meta: {
      isShow: false
    }
  },
  {
    path: '/addaddress',
    name: 'addaddress',
    component: () => import( '../views/addaddress/index.vue'),
    meta: {
      isShow: false
    }
  },
  // 地址详情页面 params 传值
  {
    path: '/addaddress/:id',
    name: 'addaddress',
    component: () => import( '../views/addaddress/index.vue'),
    meta: {
      isShow: false
    }
  },
  {
    // path: '/newgoods?isHot',
    path: '/newgoods',
    name: 'newgoods',
    component: () => import( '../views/newgoods/Index.vue'),
    meta: {
      isShow: false,
      isHot: true,
      // isShow: false,
    }
  }
]

const router = new VueRouter({
  // mode: 'history',
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
